//
//  ABaseViewController.swift
//  test-ios
//
//  Created by wyz5204 on 2023/3/18.
//

import UIKit

class ABaseViewController: UIViewController {
    
    
    deinit {
        NotificationCenter.default.removeObserver(self)
    }
    
    
    func registerObserver(selector aSelector: Selector, name aName: NSNotification.Name? = nil, object anObject: Any? = nil){
        NotificationCenter.default.addObserver(self, selector: aSelector, name: aName, object: anObject)
    }
    
    func postMessage(_ aName: NSNotification.Name, object anObject: Any? = nil){
        NotificationCenter.default.post(name: aName , object: anObject)
    }
    
    
    lazy public var rightBtn : UIButton = {
        let button = UIButton.init(type : UIButton.ButtonType.custom)
        button.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: UIFont.Weight.bold)
        return button
    }()
    
    
    lazy public var leftBtn : UIButton = {
        let button = UIButton.init(type : UIButton.ButtonType.custom)
        button.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.bold)
        button.setTitleColor(UIColor.gl_title, for: UIControl.State.normal)
        button.addTarget(self, action: #selector(onBack), for: UIControl.Event.touchUpInside)
        return button
    }()
    
    @objc func onBack(){
        self.navigationController?.popViewController(animated: true)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = .white
    }
    
}
